import { useReactive } from "ahooks";
import { useModel } from "umi";
import { useEffect } from "react";
import compress from "gql-compress";

const useAllCommodities = () => {
	const { graphqlFetch } = useModel("global");

	const state = useReactive({
		loading: false,
		commodities: [],
		totalCount: 0,
	});

	const loadAllCommodities = async (first, offset) => {
		state.loading = true;
		state.commodities = [
			{
				ciName: 1,
				ciBran: 2,
				ciSpec: 3,
				ciAlna: 123,
				ciClna: "一级分类",
				ciPict: ["https://image.uc.cn/s/wemedia/s/upload/2022/e779fd507dc81a9a144bee456d0387e3.png"],
				ciMava: 8888.065,
			},
		];
		state.loading = false;
	};

	return { ...state, loadAllCommodities };
};

let query = compress(``);

export default useAllCommodities;
